const axios = require('axios')

// create an axios instance
const service = axios.create({
  // baseURL: process.env.BASE_API, // url = base url + request url
  timeout: 10000 // request timeout
})

// 请求拦截器
service.interceptors.request.use(
  config => {
    return config
  },
  error => {
    return Promise.reject(error)
  }
)

// 响应拦截器
service.interceptors.response.use(
  response => response,
  error => {
    return Promise.reject(error);
  })

module.exports = service
